package com.boot.application.config;


import com.boot.application.bean.Car;
import com.boot.application.bean.Pet;
import com.boot.application.bean.User;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Date 2021/6/18 17:13
 * @Created by wangle
 * @Description
 */
@Configuration  //告诉spring这是一个配置类
@EnableConfigurationProperties(Car.class)
public class Myconfig {

    @Bean  //给容器方法添加组件，以方法名作为组件的id，返回的值就是组件在容器中的实例，返回的类型就是组件的类型
   public User user01(){
       return  new User( "zhangsan",29);

   }

    @Bean("tom")
   public Pet tomcatpet(){
       return  new  Pet("tuzi");

   }


}
